
import javax.swing.JFrame;
import javax.swing.*;

public class starting1
{
    JFrame jF;
    InitPanel ipanel;InitName iN;
    CAHClient c;
    public static void main()
    {
        starting1 s = new starting1();
        System.out.println("start!");
        s.jF = new JFrame();
        s.ipanel= new InitPanel(s);
        s.jF.add(s.ipanel);
        s.jF.pack();
        s.jF.setVisible(true);
        s.jF.setSize(800, 600);
        s.jF.setResizable(false);

    }

    public void login(CAHClient c){
        this.c = c;
        jF.remove(ipanel);
        iN = new InitName(this,c);
        jF.add(iN);
        jF.pack();
    }

    public void showMessage(String n){
        JOptionPane.showMessageDialog(jF, "Cannot Connect");
    }

    public void beginGame(){
        jF.remove(iN);
        mainPanel1 mP = new mainPanel1(800, 600, c);
        jF.add(mP);
        jF.pack();
        jF.setVisible(true);
        jF.setSize(800, 600);
        jF.setResizable(false);
        jF.addKeyListener(new BoardBinding());
        jF.setDefaultCloseOperation(3);
        MouseMotion mm = new MouseMotion(mP.b);
        mP.addMouseListener(mm);
        mP.addMouseMotionListener(mm);
    }
}